package org.itt;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class Properties {
        static private Properties _instance = null;
        public String CSV_TYPE = null;
        public String SPLIT_BY = null;
        public String MAX_BATCH_SIZE = null;
        public String INDEX_CUSTOMER_ID = null;
        public String INDEX_FAMILY_ID = null;
        public String INDEX_PIVA_COD_FISC = null;
        public String INDEX_MAP_ID = null;
        public String INDEX_SIGN_SINGLEDOC = null;
        public String INDEX_HASH_TYPE = null;
        public String INDEX_HASH_TYPE_CODE = null;
        public String MAX_COLUMN_SIZE = null;
        public String WORKDIR = null;
        public String OUTPUT = null;
        public String OUTPUT_FILE_PREFIX = null;
        public String SOURCE = null;
        public String FLOW_ID = null;
        public String CUSTOMER_NAME = null;
        public String CHUNK = null;

        protected Properties() {
                try {
                        InputStream file = new FileInputStream(new File("csv2xml.properties"));

                        java.util.Properties props = new java.util.Properties();

                        props.load(file);

                        CSV_TYPE = props.getProperty("CSV_TYPE");

                        SPLIT_BY = props.getProperty("SPLIT_BY");

                        MAX_BATCH_SIZE = props.getProperty("MAX_BATCH_SIZE");

                        INDEX_CUSTOMER_ID = props.getProperty("INDEX_CUSTOMER_ID");

                        INDEX_FAMILY_ID = props.getProperty("INDEX_FAMILY_ID");

                        INDEX_PIVA_COD_FISC = props.getProperty("INDEX_PIVA_COD_FISC");

                        INDEX_MAP_ID = props.getProperty("INDEX_MAP_ID");

                        INDEX_SIGN_SINGLEDOC = props.getProperty("INDEX_SIGN_SINGLEDOC");

                        INDEX_HASH_TYPE = props.getProperty("INDEX_HASH_TYPE");

                        INDEX_HASH_TYPE_CODE = props.getProperty("INDEX_HASH_TYPE_CODE");
                       
                        MAX_COLUMN_SIZE = props.getProperty("MAX_COLUMN_SIZE");

                        WORKDIR = props.getProperty("WORKDIR");

                        OUTPUT = props.getProperty("OUTPUT");

                        OUTPUT_FILE_PREFIX = props.getProperty("OUTPUT_FILE_PREFIX");

                        SOURCE = props.getProperty("SOURCE");

                        FLOW_ID = props.getProperty("FLOW_ID");

                        CUSTOMER_NAME = props.getProperty("CUSTOMER_NAME");

                        CHUNK = props.getProperty("CHUNK");
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }

        }

        static public Properties get() {
                if (_instance == null) {
                        _instance = new Properties();
                }

                return _instance;
        }
}
